package com.hl.shifangzhiyu.web;

import com.hl.shifangzhiyu.pojo.ConsultationRecord;
import com.hl.shifangzhiyu.pojo.ConsultationRecordDTO;
import com.hl.shifangzhiyu.pojo.R;
import com.hl.shifangzhiyu.service.ConsultationRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/consultation")
public class ConsultationRecordController {
    @Autowired
    private ConsultationRecordService consultationRecordService;
    // 查询记录
    @GetMapping("/user/{userId}")
    public R getRecordsByUserId(@PathVariable Integer userId) {
        List<ConsultationRecordDTO> records = consultationRecordService.getRecordsByUserId(userId);
        return R.ok(records);
    }
    // 更新评价状态
    @PostMapping("/evaluate")
    public R updateEvaluateStatus(@RequestParam Integer id, @RequestParam Integer evaluateStatus) {
        boolean success = consultationRecordService.updateEvaluateStatus(id, evaluateStatus);
        return success ? R.ok() : R.fail("更新评价状态失败");
    }
}
